<?php	
	require_once ('../businessObjects/sysConfigParameters.php');
	class sysFunctions {
	
			function convertToSQLString($string){
				return '\''.$string.'\'';
			} 
			
			function smallSentence($val,$max){
				
				$values = explode(' ',$val,10);
				$counter = 0;
				$newRes = '';

				while ((list(, $value) = each($values)) && ($counter < $max)) {
					$newRes .= $value.' ';
					$counter++;		
				}
				$newRes .= ' ...';
				return $newRes;
			}
			
			function encryptData($input){			
				return base64_encode($input);
			}
			function decryptData($input){
				return base64_decode($input);
			}
			
			function uploadFile($fileArry){								
				if ($fileArry['error'] == 0){					
					$sourceFile = explode('.',$fileArry["name"]);
					$sourceFile_extension = end($sourceFile);				
					$file_name = date('Ymd-His-').rand(0,100).".".$sourceFile_extension;
					$targetFile = sysConfigParameters::sysDocumentRoot . $file_name;
					move_uploaded_file($fileArry["tmp_name"],$targetFile);
				}
				return $file_name;
			}
	}
?>